home *** CD-ROM | disk | FTP | other *** search
- Path: cypher.3do.com!user
- From: tsw@3do.com (Tom Watson)
- Newsgroups: comp.os.linux.setup,comp.os.linux.misc,comp.os.linux,comp.lang.c,comp.lang.c++
- Subject: Re: problems with GCC
- Date: Wed, 17 Apr 1996 11:30:09 -0800
- Organization: The 3DO Corporation
- Distribution: world
- Message-ID: <tsw-1704961130090001@cypher.3do.com>
- References: <4l1and$iql@news.ran.es>
- NNTP-Posting-Host: cypher.3do.com
-
- In article <4l1and$iql@news.ran.es>, chano@ran.es (Chano G≤mez Martφnez) wrote:
-
- > First of all, I want to apologize for my awful English.
- >
- > Now, the C stuff :
- >
- > I'm trying to port a C program from Borland C++ 3.1 to GCC under
- > Linux.
- > My problem is that I can't use any function from math.h !!!
- > The file is correctly #include'd ( in fact, I get no compilation
- > errors ) but the linker always tells me something like :
- >
- > /tmp/cca000971.o(.text+0x39): undefined reference to `exp'
- >
- > The funny thing is that GPC ( the GNU Pascal compiler ) allows me to
- > use math.h functions lihe exp(), sin(), fabs(), etc, but when I
- > convert my Pascal programs to C with p2c and try to compile them with
- > GCC , I get the same error again.
- >
- <<<deletia regarding GPC and gcc>>>
- >
- > The only apparent difference between both results is in the libraries
- > ( I think)
- > Can anyone help me, please ???
- >
-
- Yes, the difference is in the libraries. To use exp, sin, ...
- you need to include '-lm' (at least on your system) in the invoking 'gcc'
- line. The GPC thing had it already included. Most functions in <math.h>
- need the '-lm' addition if compiled under a Unix style compiler. This is
- probably an FAQ! (see the C faq's on the friendly 'rtfm' server).
-
- --
- Tom Watson
- tsw@3do.com (Home: tsw@johana.com)
-